package xxl.config.clock;

import cn.hutool.core.date.DateTime;
import cn.hutool.cron.CronUtil;
import cn.hutool.cron.task.Task;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;

/**
 * @Author: xixil
 * @Date: 2019/8/15
 */
public class Start implements Task {

    @Override
    public void execute() {
        HttpResponse httpResponse =
                HttpUtil.createPost("http://oa.1322.com/api/user/login").body("{\"account\":\"lj-271\",\"password\":\"qq8248866\"}").execute();

        String token = JSONUtil.parseObj(JSONUtil.parseObj(httpResponse.body()).get("data")).getStr("token");

        HttpUtil.createGet("http://192.168.8.251:8881/attendance/clockIn")
                .header("User-Agent", "")
                .header("Authorization", "Bearer " + token).execute();

//        System.out.println("key:" + RunReSet.M_KEY);
        System.out.println(DateTime.now());
//        CronUtil.remove(RunReSet.M_KEY);
//        RunReSet.M_KEY = "";
    }
}
